<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>结构赋值</title>
</head>
<body>

</body>
<script>


    function concat1(){
        const arr1=[1,3,4];
        const arr2=[2,5,7];

        /*把上述两个数组合并成一个数组*/

        for (let i = 0; i <arr2.length ; i++) {
            arr1.push(arr2[i]);
        }

        console.log(arr1);
    }

    function concat2(){
        const arr1=[1,3,4];
        const arr2=[2,5,7];
        //let arr3=[];

        /*把上述两个数组合并成一个数组*/

        let  arr3=  arr1.concat(arr2);

        console.log(arr3);
    }

    function concat3(){
        const arr1=[1,3,4];
        const arr2=[2,5,7];
        /**
         * arr1:  1,3,4
         * arr2:  2,5,7
         *   1,3,4,2,5,7
         *   [ 1,3,4,2,5,7 ]
         *   eval([ 1,3,4,2,5,7 ])
        * */
        const arr3=[...arr1,...arr2];
        console.log(arr3);
    }


    /**
     *   {}  也可以被认为是一个集合  key-value
     *   []  也可以被认为是一个集合  key-value
     * */
    function  concat4(){

        const emp_part1={
            id:1,
            age:23
        }

        const emp_part2={
            name:'Lee',
            gender:'male'
        }

        const employee1 = {...emp_part1,...emp_part2};

        console.log(employee1);
    }


    concat4();
</script>

</html>